﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Autofac;
using Autofac.Integration.WebApi;
using System.Web.Http;

namespace NCLCustomerManagement.UI.Helper
{
    public class BCFactory : IBCFactory
    {
        public T GetBC<T>()
        {
            var resolver = (AutofacWebApiDependencyResolver)GlobalConfiguration.Configuration.DependencyResolver;
            return (resolver.Container as IContainer).Resolve<T>();
        }

        public object GetBC(Type bcType)
        {
            var resolver = (AutofacWebApiDependencyResolver)GlobalConfiguration.Configuration.DependencyResolver;
            return (resolver.Container as IContainer).Resolve(bcType);
        }
    }
}